package cn.shiva.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author shiva   2021/10/16 17:01
 */
@Configuration
public class FilterConfig {
    @Autowired
    private StreamFilter streamFilter;

    @Bean
    public FilterRegistrationBean registFilter() {
        FilterRegistrationBean registration = new FilterRegistrationBean();
        registration.setFilter(streamFilter);
        registration.addUrlPatterns("/stream/wapperDemo");
        registration.setName("streamFilter");
        registration.setOrder(1);
        return registration;
    }
}
